//
//  ViewController.swift
//  旅航ios
//
//  Created by tulip on 2021/4/21.
//

import UIKit

class ViewController: UITabBarController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.tabBar.isTranslucent=false //半透明属性
        
        UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.init(hexString: "3e7dff")], for: .selected)
        UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.init(hexString: "666666")], for: .normal)
        
        
        //   self.tabBar.barTintColor=UIColor.init(hexString: "7bdaf6")
        
        //home
        let img_home=UIImage(named: "首页")?.withRenderingMode(.alwaysOriginal)
        let img_home_sel=UIImage(named: "首页-选中")?.withRenderingMode(.alwaysOriginal)
        let home_vc =  HomeVC.init()
        home_vc.tabBarItem=UITabBarItem.init(title: "首页", image: img_home, selectedImage: img_home_sel)
        let home_nav = UINavigationController.init(rootViewController: home_vc)
        self.addChild(home_nav)
        
        //shop
        let img_shop=UIImage(named: "商城")?.withRenderingMode(.alwaysOriginal)
        let img_shop_sel=UIImage(named: "商城-选中")?.withRenderingMode(.alwaysOriginal)
        let shop_vc =  HomeVC.init()
        shop_vc.tabBarItem=UITabBarItem.init(title: "商城", image: img_shop, selectedImage: img_shop_sel)
        let shop_nav = UINavigationController.init(rootViewController: shop_vc)
        self.addChild(shop_nav)
        
        //news
        let img_news=UIImage(named: "资讯")?.withRenderingMode(.alwaysOriginal)
        let img_news_sel=UIImage(named: "资讯-选中")?.withRenderingMode(.alwaysOriginal)
        let news_vc =  NewsVC.init()
        news_vc.tabBarItem=UITabBarItem.init(title: "资讯", image: img_news, selectedImage: img_news_sel)
        let news_nav = UINavigationController.init(rootViewController: news_vc)
        self.addChild(news_nav)
        
        
        //me
        let img_me=UIImage(named: "我的")?.withRenderingMode(.alwaysOriginal)
        let img_me_sel=UIImage(named: "我的-选中")?.withRenderingMode(.alwaysOriginal)
        let me_vc = MeVC.init()
        me_vc.tabBarItem=UITabBarItem.init(title: "我的", image: img_me, selectedImage: img_me_sel)
        let me_nav = UINavigationController.init(rootViewController: me_vc)
        self.addChild(me_nav)
    }
    
    
}
